<!--
 * @Author: error: git config user.name && git config user.email & please set dead value or install git
 * @Date: 2022-12-28 22:27:40
 * @LastEditors: 朱安武 549410045@qq.com
 * @LastEditTime: 2023-01-18 18:25:21
 * @FilePath: \html学习\vue-test\vue-history\src\components\PageA.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <h1>A</h1>
    <RouterLink :to="{ path: '/pageB', query: { name: JSON.stringify(a) } }">点我到B</RouterLink>
    {{ a }}
    <button @click="inc">+</button>
    <button @click="jump">跳转</button>
</template>
<script>
export default {
    data() {
        return {
            a: {
                name: 'jerry',
                age: 22
            }
        }
    },
    methods: {
        inc() {
            this.a.age++
        },
        jump() {
            this.$router.push(
                {
                    path: '/pageB',
                    query: this.a
                }
            )
        }
    },
}
</script>